package com.github.rxyor.example.dubbo.consumer.poet.controller;

import com.github.rxyor.example.dubbo.api.poet.Poet;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *<p>
 *
 *</p>
 *
 * @author liuyang
 * @date 2019-07-20 Sat 14:40:00
 * @since 1.0.0
 */
@Api
@RestController
@RequestMapping("/consumer/poet")
public class PoetController {

    @Reference(version = "poetSuShi")
    private Poet poetSuShi;

    @Reference(version = "poetTagore")
    private Poet poetTagore;

    @Reference(version = "poetAnonymity")
    private Poet poetAnonymity;

    @ApiOperation(value = "苏轼吟诗", httpMethod = "GET")
    @GetMapping("/get/by/sushi")
    @ResponseBody
    public String getPoemBySuShi() {
        return poetSuShi.createPoem();
    }

    @ApiOperation(value = "泰戈尔吟诗", httpMethod = "GET")
    @GetMapping("/get/by/tagore")
    @ResponseBody
    public String getPoeByTagore() {
        return poetTagore.createPoem();
    }

    @ApiOperation(value = "无名者吟诗", httpMethod = "GET")
    @GetMapping("/get/by/anonymity")
    @ResponseBody
    public String getPoemByAnonymity() {
        return poetAnonymity.createPoem();
    }

}
